﻿using SimpleInjector;
using Sustainalytics.ClientDW.Synchronization.SyncHbaseData;
using Sustainalytics.Synchronization.Interface;
using System.Collections.Generic;
using System.Diagnostics;
using Xunit.Abstractions;

namespace GetHbaseDataTests.Helpers
{
    public abstract class BaseSyncHbaseTests : ILogger
    {
        protected Container SimpleInjectorContainer;

        private readonly ITestOutputHelper output;

        protected readonly Dictionary<string, string> gaConnectionStrings = new Dictionary<string, string>
        {
            { "ClientDW", "mongodb://127.0.0.1:27017/GaCddbConnector" },
            { "GovernanceDW", "mongodb://127.0.0.1:27017/GaCddbConnector" },
            { "CompanySearchDW", "mongodb://127.0.0.1:27017/CompanySearchDW" }
        };

        protected readonly Dictionary<string, string> dsConnectionStrings = new Dictionary<string, string>
        {
            { "ClientDW", "mongodb://127.0.0.1:27017/DsCddbConnector" },
            { "GovernanceDW", "mongodb://127.0.0.1:27017/DsCddbConnector" },
            { "CompanySearchDW", "mongodb://127.0.0.1:27018/CompanySearchDW" }
        };

        protected BaseSyncHbaseTests(ITestOutputHelper output)
        {
            Debug.Listeners.Add(new DefaultTraceListener());
            this.output = output;
            AutoMapperConfig.RegisterMappings();
            SimpleInjectorContainer = SimpleInjectorConfig.Register(this, gaConnectionStrings, dsConnectionStrings);
        }

        public void Log(string message)
        {
            output.WriteLine(message);
        }
    }
}
